package cn.vihub.service.impl;

import cn.vihub.param.ShopGoodsAttributeParam;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.vihub.mapper.ShopGoodsAttributeMapper;
import cn.vihub.pojo.ShopGoodsAttribute;
import cn.vihub.service.ShopGoodsAttributeService;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author: 秋晚
 * @Date:  2025/7/25 20:20
 * @Description: 
 **/

@Service
@Transactional(rollbackFor = Exception.class)
public class ShopGoodsAttributeServiceImpl extends ServiceImpl<ShopGoodsAttributeMapper, ShopGoodsAttribute> implements ShopGoodsAttributeService{

    @Autowired
    ShopGoodsAttributeMapper shopGoodsAttributeMapper;
    @Override
    public IPage<ShopGoodsAttribute> shopGoodsPage(ShopGoodsAttributeParam shopGoodsAttributeParam) {
        //创建分页对象
        Page<ShopGoodsAttribute> shopGoodsAttributePage = new Page<>(shopGoodsAttributeParam.getPage(), shopGoodsAttributeParam.getLimit());
        //创建lambda表达式
        LambdaQueryWrapper<ShopGoodsAttribute> lambdaQueryWrapper = new LambdaQueryWrapper<ShopGoodsAttribute>().eq(ShopGoodsAttribute::getGroupId, shopGoodsAttributeParam.getGroupId());

        return shopGoodsAttributeMapper.selectPage(shopGoodsAttributePage,lambdaQueryWrapper);
    }
}
